<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      body {
        padding: 50px;
      }

      article {
        width: 200px;
        height: 200px;
        border: solid 2px blueviolet;
        cursor: pointer;
        position: relative;
      }

      article div {
        width: 200px;
        height: 200px;
        position: absolute;
      }

      /* 鼠标移到article上面层级改变 绿色的层级比较高。 */
      article:hover div:nth-of-type(2) {
        z-index: 2;
      }

      article div:nth-of-type(1) {
        background: red;
        left: 0;
        top: 0;
        z-index: 1;
      }

      article div:nth-of-type(2) {
        background: green;
        left: 50px;
        top: 50px;
      }
    </style>
  </head>
  <body>
    <article>
      <div></div>
      <div></div>
    </article>
  </body>
</html>
